package com.mark.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.exam.entity.Exam;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.user.entity.Student;

@Entity
@Table(name="t_stuanswer")
public class StuAnswer {
	private Long id;
	private Exam exam;
	private Student student;
	private boolean completed;//是否交卷
	private boolean marked;//是否阅卷完毕
	private List<StuOptions> stuOptions = new ArrayList<StuOptions>();
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	@JsonIgnore
	@ManyToOne
	public Exam getExam() {
		return exam;
	}
	@ManyToOne(fetch=FetchType.EAGER)
	public Student getStudent() {
		return student;
	}
	@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
	@JoinColumn(name="stuanswerId")
	public List<StuOptions> getStuOptions() {
		return stuOptions;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public void setExam(Exam exam) {
		this.exam = exam;
	}
	public void setStudent(Student student) {
		this.student = student;
	}
	public void setStuOptions(List<StuOptions> stuOptions) {
		this.stuOptions = stuOptions;
	}
	public boolean isCompleted() {
		return completed;
	}
	public void setCompleted(boolean completed) {
		this.completed = completed;
	}
	public boolean isMarked() {
		return marked;
	}
	public void setMarked(boolean marked) {
		this.marked = marked;
	}
	
}
